package edu.ncsu.csc.itrust.http;

import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;


/**
 * Bug # 1 in HW2P2
 * @author stbowen & pjfinega
 *
 */
public class ActivityFeedSpellingTest extends iTrustHTTPTest {

    /**
     * Clear and setup database for independent testing
     */
    protected void setUp() throws Exception{
        super.setUp();
        gen.clearAllTables();
        gen.standardData();
    }
    
    /**
     * Tests that proper spelling output of "[HCP] viwed your basic health information today at X:XXAM/PM."
     * as a patient.
     * @throws Exception
     */
    public void testViewBasicHealthInfoFeed() throws Exception {
        
        setUp();
        
        //Kelly Doctor looks at Patient Basic Health History
        WebConversation wc = login("9000000000", "pw");
        WebResponse wr = wc.getCurrentPage();
        wr = wr.getLinkWith("All Patients").click();
        wr = wr.getLinkWith("Andy Programmer").click();
        wr = wr.getLinkWith("Basic Health History").click();
        wr = wr.getLinkWith("Logout").click();
        //Patient looks at feed
        WebConversation wc2 = login("2", "pw");
        WebResponse wr2 = wc2.getCurrentPage();
        String s = wr2.getText();
               
        assertTrue( s.contains("Kelly Doctor</a> viewed your basic health information today") );
        
    }
    
}